var app = angular.module('nodeProject2');
app.directive("accordionGroup",function(){
  return {
    restrict:"E",
    template:'<div class="panel-group" id="accordion" ng-transclude></div>',
    replace:true,
    transclude : true,
    controller : function() {
      var expanders = [];
      this.gotOpened = function(selectedExpander) {
        angular.forEach(expanders, function(expander) {
          if (selectedExpander != expander) {
            expander.showMe = false;
          }
        });
      }
      this.addExpander = function(expander) {
        expanders.push(expander);
      }
    }
  }
});

app.directive("accordionPanel",function(){
  return {
    restrict:"EA",
    template:'<div class="panel panel-default">'+
                '<div class="panel-heading">'+
                  '<h4 class="panel-title">'+
                    '<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">{{title}}</a>'+
                '</h4>'+
                '</div>'+
                '<div id="collapseOne" class="panel-collapse collapse in">'+
                  '<div class="panel-body" ng-transclude></div>'+
                '</div>'+
              '</div>',
    replace:true,
    transclude : true,
    require : '^?accordionGroup',
    scope : {
      title : '=expanderTitle'
    },
    link:function(scope, element, attrs, accordionController){

    }
  }
});





app.config(['$routeProvider',
  function ($routeProvider) {

    $routeProvider.when('/db_manager', {
      templateUrl: 'app/db_manager/db_manager.html',
      controller: 'db_manager_controller',
      controllerAs: 'db_manager_controller'
    });

  }]);


